package Day7;

import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.Stack;

public class Test1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String s = in.nextLine();
            char[] ch = s.toCharArray();
            Queue<Character> queue = new LinkedList<>();
            int size = 0;
            int index = 0;
            for(int i = 0; i< ch.length;i++){
                int len = 0;
                char c = ' ';
                if(ch[i] < 65){
                    queue.add(ch[i]);
                }else{
                    len = queue.size();
                    if(!queue.isEmpty()){
                        c = queue.peek();
                    }
                    while(!queue.isEmpty()){
                        queue.poll();
                    }
                }
                //size = Math.max(size,len);
                if(size < len){
                    index = s.indexOf(c);
                }
            }
            System.out.println(s.substring(index,index + size - 1));
        }
    }
}
